/*
 * Created on Feb 16, 2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package ar.edu.utn.frba.gdaia.src.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author Patricio
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class ListBuilder {

	private List<Object> list;

	public ListBuilder(List lista) {
		this.list = new ArrayList<Object>();
		this.list.addAll(lista);
	}
	public ListBuilder() {
		this.list = new ArrayList<Object>();
	}

	public ListBuilder add(Object o) {
		list.add(o);
		return this;
	}
	public ListBuilder add(List lista) {
		list.addAll(lista);
		return this;
	}

	public List get() {
		return list;
	}

	public String toString() {
		String string = "[";
		for (Iterator iter = this.list.iterator(); iter.hasNext();) {
			Object element = (Object) iter.next();
			string = string + element.toString();
			if(iter.hasNext()) string = string + ", ";
		}
		return string + "]";
	}

}
